package com.origin.ebuy.bargd.service.good;

import java.sql.SQLException;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * 商品业务处理
 * @author Administrator
 *
 */
public interface IgoodService {
	/**
	 * 添加商品
	 * @param object
	 * @return
	 */
	public int addGood(JSONObject object)throws SQLException;
	
	/**
	 * 查询商品
	 * @return
	 * @throws SQLException
	 */
	public JSONArray queryGoods()throws SQLException;
	
	/**
	 * 查询商品
	 * @return
	 * @throws SQLException
	 */
	public JSONObject queryGood(String id)throws SQLException;
	
	/**
	 * 更新商品
	 * @param object
	 * @return
	 * @throws SQLException
	 */
	public int updateGood(String gdid,String name,String price,String numbers,String image,String state)throws SQLException;

	/**
	 * 根据商品id删除商品
	 * @param gdid
	 * @return
	 * @throws SQLException
	 */
	public int deleteGood(String gdid)throws SQLException;
	
	/**
	 * 前台查询商品
	 * @return
	 * @throws SQLException
	 */
	public JSONArray fgqueryGoods()throws SQLException;
	
	
	public int buyGood(JSONObject object)throws SQLException;
	
	/**
	 * 查询商品剩余数量
	 * @param id
	 * @return
	 * @throws SQLException
	 */
	public int queryGoodLeftNumbers(String id)throws SQLException;
	
	/**
	 * 更新商品剩余的数量
	 * @param number
	 * @return
	 * @throws SQLException
	 */
	public int updateGoodNumber(int number,String id)throws SQLException;
	
}
